<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <title>供应商绩效评分系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="A fully responsive admin theme which can be used to build CRM, CMS,ERP etc." name="description"/>
    <meta content="Techzaa" name="author"/>
    <link rel="shortcut icon" href="../../images/favicon.ico">
    <script src="../../js/config.js"></script>
    <link href="../../css/app.min.css" rel="stylesheet" type="text/css" id="app-style"/>
    <link href="../../css/icons.min.css" rel="stylesheet" type="text/css"/>
</head>
<body class="authentication-bg position-relative">
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5 position-relative">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-xxl-8 col-lg-10">
                <div class="card overflow-hidden">
                    <div class="row g-0">
                        <div class="col-lg-6 d-none d-lg-block p-2">
                            <img src="../../images/auth-img.jpg" alt="" class="img-fluid rounded h-100">
                        </div>
                        <div class="col-lg-6">
                            <div class="d-flex flex-column h-100">
                                <div class="auth-brand p-4">
                                    <a href="#" class="logo-light">
                                        <img src="../../images/logo.png" alt="logo" height="22">
                                    </a>
                                    <a href="#" class="logo-dark">
                                        <img src="../../images/logo-new.png" alt="dark logo" height="22">
                                    </a>
                                </div>
                                <div class="p-4 my-auto">
                                    <h4 class="fs-20">登录</h4>
                                    <p class="text-muted mb-3">输入您的账号密码进行登录
                                    </p>
                                    <div class="mb-3">
                                        <label for="username" class="form-label">用户名</label>
                                        <input class="form-control" type="text" id="username" required=""
                                               placeholder="输入用户名">
                                    </div>
                                    <div class="mb-3">
                                        <a href="/user/forgotpw" class="text-muted float-end"><small>忘记密码?</small></a>
                                        <label for="password" class="form-label">密码</label>
                                        <input class="form-control" type="password" required="" id="password"
                                               placeholder="输入密码">
                                    </div>
                                    <div class="mb-3">
                                        <div class="form-check">
                                            <input type="checkbox" class="form-check-input" id="checkbox-signin">
                                            <label class="form-check-label" for="checkbox-signin">记住我</label>
                                        </div>
                                    </div>
                                    <div class="mb-0 text-start">
                                        <button class="btn btn-soft-primary w-100" onclick="login()"><i
                                                class="ri-login-circle-fill me-1"></i> <span class="fw-bold">登录</span></button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-12 text-center">
                <p class="text-dark-emphasis">还没有账号?
                    <a href="/user/register" class="text-dark fw-bold ms-1 link-offset-3 text-decoration-underline">
                        <b>注册</b></a>
                </p>
            </div>
        </div>
    </div>
</div>
<footer class="footer footer-alt fw-medium">
<span class="text-dark">
<script>document.write(new Date().getFullYear())</script> © 供应商绩效评分系统
</span>
</footer>
<script src="../../js/vendor.min.js"></script>
<script src="../../js/app.min.js"></script>
<script>
    function login() {
        let data = {
            username: $('#username').val(),
            password: $('#password').val()
        }
        $.ajax({
            url: '/user/loginverify',
            type: 'post',
            data: JSON.stringify(data),
            contentType: "application/json;charset=UTF-8",
            dataType: 'json',
            success: function (res) {
                if (res.code == 200) {
                    window.location.href='/user/init';
                } else {
                    alert('账号名或密码错误');
                }
            },
            error: function (res) {
                alert('登录失败');
            }
        });
    }
</script>
</body>
</html>